//
//  UICheckBox.m
// Halfarea
//
//  Created by Bindx on 4/22/14.
//
//

#import "UICheckBox.h"

@implementation UICheckBox

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackGroundImage];
    }
    return self;
}

- (void)setBackGroundImage
{
    [self setImage:[UIImage imageNamed:@"noselect.png"] forState:UIControlStateNormal];
    [self setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateSelected];
    [self addTarget:self action:@selector(touchUIInside:) forControlEvents:UIControlEventTouchUpInside];
}

-(id)initWithCoder:(NSCoder *)aDecoder
{
    self =  [super initWithCoder:aDecoder];
    if (self) {
        [self setBackGroundImage];
    }
    return self;
}

-(IBAction)touchUIInside:(id)sender
{
    UICheckBox* cb= (UICheckBox*)sender;
    cb.selected = !cb.selected;
}

@end
